import service from '@/utils/request';

// 查询公告列表
export const getListData = (params?: any) => {
  return service.request({
    url: '/system/menu/list',
    method: 'get',
    params,
  });
};

// 查询菜单详细
export const getMenu = (menuId: string) => {
  return service.request({
    url: `/system/menu/${menuId}`,
    method: 'get',
  });
};

// 查询菜单下拉树结构
export const treeselect = () => {
  return service.request({
    url: '/system/menu/treeselect',
    method: 'get',
  });
};

// 根据角色ID查询菜单下拉树结构
export const roleMenuTreeselect = (roleId: string) => {
  return service.request({
    url: `/system/menu/roleMenuTreeselect/${roleId}`,
    method: 'get',
  });
};

// 新增菜单
export const addMenu = (data: any) => {
  return service.request({
    url: '/system/menu',
    method: 'post',
    data,
  });
};

// 修改菜单
export const updateMenu = (data: any) => {
  return service.request({
    url: '/system/menu',
    method: 'put',
    data,
  });
};

// 删除菜单
export const delMenu = (menuId: string) => {
  return service.request({
    url: `/system/menu/${menuId}`,
    method: 'delete',
  });
};
